<html>
    <head>
        <title>Simple</title>
        <style type="text/css">
            
        </style>
        <link type="text/css" rel="Stylesheet" href="jquery.validity.css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" src="aetas.js"></script>
        <script type="text/javascript">
            var 
                log = [],
                currentTest = '',
                failure = false;
            
            function expect(e, r) {
                if (e == r) {
                    log.push({ 
                        tname:currentTest,
                        passed:true
                    });
                }
                else {
                    failure = true;
                    log.push({ 
                        tname:currentTest,
                        passed:false,
                        message:[ "Expected: \"", e, "\" Found: \"", r, "\"" ].join("")
                    });
                }
            }
            
            var tests = {};

            $(function() { 
                perform();
            });
            
            function perform() {
                if (true || confirm("Do tests?")) {
                    
                    for (var test in tests) {
                        currentTest = test;
                        tests[test]();
                    }
                }
                
                if (failure) {
                    $("body").html("<h1 style='color:#f00;'>Fail: Some tests failed.</h1><ul/>");
                }
                
                else {
                    $("body").html("<h1 style='color:#0f0;'>All tests succeeded.</h1><ul/>");
                }

                for (var idx = 0; idx < log.length; idx++) {
                    $("<li>")
                        .css("color", log[idx].passed ? "#0f0" : "red")
                        .html([
                            "<strong>Test: ",
                            log[idx].tname,
                            "</strong> ",
                            log[idx].passed ?
                                "Passed" :
                                "Failed: ",
                            log[idx].message
                        ].join(""))
                        .appendTo("ul");
                }
                
                $("<a href='javascript:location.reload();'>Go again</a>")
                    .appendTo("body");
            }
        </script>
        <script type="text/javascript" src="unittests.js"></script>
    </head>
    <body>
    </body>
</html>
